/*
 * @Description: 
 * @Author: charles
 * @Date: 2021-11-15 11:16:36
 * @LastEditors: charles
 * @LastEditTime: 2021-11-15 11:46:42
 */
import {put,call,  takeEvery} from 'redux-saga/effects'
import axios from 'axios'
function* loadArticles(){
  let url = "http://121.199.29.84:8002/index/pageQueryArticles";
  let params = {page:1,pageSize:10};
  //let resp =yield axios.get(url,{params});
  let resp = yield call(axios.get,url,{params})
  // 如何将resp更新到状态
  yield put({type:"REFRESH_ARTICLES",payload:resp.data.data.list})
}


export default function* (){
  // 向外暴露一个异步action , {type:"loadArticles"}
  yield takeEvery('loadArticles',loadArticles)
}

